package com.wbk.lotterysystemsystemservice.controller.biz;

import com.wbk.lotterysystemsystemservice.service.EmailService;

import com.wbk.system.qo.LotteryAuditResultQO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.wbk.system.qo.StoreAuditResultQO;
import result.Result;

@Component
public class EmailBiz {

    @Autowired
    EmailService emailService;

    public Result<String> sendCode(String email) {
        try {
            emailService.sendCode(email);
        } catch (Exception e) {
            return new Result<>(100, "发送失败!请检查邮箱地址是否有误", e.getMessage());
        }
        return new Result<>(200, "发送成功!", "有效期为5分钟");
    }

    public Result<String> storeAuditResult(StoreAuditResultQO storeAuditResultQO) {
        try {
            emailService.storeAuditResult(storeAuditResultQO);
        } catch (Exception e) {
            return new Result<>(100, "发送失败!", e.getMessage());
        }
        return new Result<>(200, "发送成功!", null);
    }

    public Result<String> lotteryAuditResult(LotteryAuditResultQO lotteryAuditResultQO) {
        try {
            emailService.lotteryAuditResult(lotteryAuditResultQO);
        } catch (Exception e) {
            return new Result<>(100, "发送失败!", e.getMessage());
        }
        return new Result<>(200, "发送成功!", null);
    }
}
